//
// Project: Disagreement in science: Missing women



clear all
version 15.1  



//
// set locals

// method of identifying female variable
local female "female_genderize"

// gender of author is known
local known_gender "female_genderize!=."




//
// AER

// call data
use "${data}/output/aer_data_gender.dta", clear
drop if month=="May" & year!=2019  // exclude AEA papers and proceedings
drop if year==2020  
keep if (comment | research_article)

// bin 2-year intervals together for less noisy figure
generate aggyear = .
local i = 1
forvalues y=1999(2)2019 {
	replace aggyear = `i' if year>=`y' & year<=`y'+1
	local i = `i'+1
}

//variable labels for graph
label define pubtype 0 "regular article" 1 "comment"
label values comment pubtype

// analysis
regress `female' i.comment##i.aggyear if `known_gender'
margins aggyear#comment
marginsplot, plotregion(style(none)) scheme(s1color) title("") xtitle("Years") ytitle("Share of female authors") noci xlabel(1 `"99-00"' 2 `"01-02"' 3 `"03-04"' 4 `"05-06"' 5 `"07-08"' 6 `"09-10"' 7 `"11-12"' 8 `"13-14"' 9 `"15-16"' 10 `"17-18"' 11 `"19"', noticks labsize(medsmall)) ylabel(0 0.05 `"0.05"' .10 `"0.10"' .15 `"0.15"' .20 `"0.20"' .25 `"0.25"' .30 `"0.30"' .35 `"0.35"' .4 `"0.40"' .45 `"0.45"' .5 `"0.50"', grid angle(horizontal) labsize(medsmall)) yscale(r(., .5)) plotopts(lwidth(thick) legend(col(1) ring(0) bplacement(1) region(style(none)) symxsize(*0.75) size(medsmall) label(1 "regular article") label(2 "comment"))) plot1opts(color(gs3%80) msymbol(O) msize(medium)) plot2opts(color(gs9%80) msymbol(S) msize(medium))
graph export "${output}/trend_difference_aer.eps", replace
graph export "${output}/trend_difference_aer.png", replace



//
// ASR

// call data
use "${data}/output/asr_data_gender.dta", clear
keep if (comment | research_article)

// bin 2-year intervals together for less noisy figure
generate aggyear = .
local i = 1
forvalues y=2004(2)2018 {
	replace aggyear = `i' if year>=`y' & year<=`y'+1
	local i = `i'+1
}

//variable labels for graph
label define pubtype 0 "regular article" 1 "comment"
label values comment pubtype

// analysis
regress `female' i.comment##i.aggyear if `known_gender'
margins aggyear#comment
marginsplot, plotregion(style(none)) scheme(s1color) title("") xtitle("Years") ytitle("Share of female authors") noci xlabel(1 `"04-05"' 2 `"06-07"' 3 `"08-09"' 4 `"10-11"' 5 `"12-13"' 6 `"14-15"' 7 `"16-17"' 8 `"18-19"' ,noticks labsize(medsmall)) ylabel(0 0.05 `"0.05"' .10 `"0.10"' .15 `"0.15"' .20 `"0.20"' .25 `"0.25"' .30 `"0.30"' .35 `"0.35"' .4 `"0.40"' .45 `"0.45"' .5 `"0.50"', grid angle(horizontal) labsize(medsmall)) yscale(r(., .5)) plotopts(lwidth(thick) legend(col(1) ring(0) bplacement(1) region(style(none)) symxsize(*0.75) size(medsmall) label(1 "regural article") label(2 "comment"))) plot1opts(color(gs3%80) msymbol(O) msize(medium)) plot2opts(color(gs9%80) msymbol(S) msize(medium))
graph export "${output}/trend_difference_asr.eps", replace
graph export "${output}/trend_difference_asr.png", replace



//
// JAMA

// call data
use "${data}/output/jama_pubmed_data_gender.dta", clear
drop if year==2020  
drop if year<2002  // full author names from PubMed not available
drop if year<2013  // Comment & Response section started in July 2013
drop if year==2013 & month=="January"  // Comment & Response section started in July 2013
drop if year==2013 & month=="February"  // Comment & Response section started in July 2013
drop if year==2013 & month=="March"  // Comment & Response section started in July 2013
drop if year==2013 & month=="April"  // Comment & Response section started in July 2013
drop if year==2013 & month=="May"  // Comment & Response section started in July 2013
drop if year==2013 & month=="June"  // Comment & Response section started in July 2013 
keep if comment | research_article
drop if article_with_etal
drop if strpos(full_name, "Fontanarosa")  // this JAMA editor appeared as first author of letters to the editor

//variable labels for graph
label define pubtype 0 "regular article" 1 "comment"
label values comment pubtype

// analysis
regress `female' i.comment##i.year if `known_gender'
margins year#comment
marginsplot, plotregion(style(none)) scheme(s1color) title("") xtitle("Years") ytitle("Share of female authors") noci xlabel(2013 2014 2015 2016 2017 2018 2019, noticks labsize(medsmall)) ylabel(0 0.05 `"0.05"' .10 `"0.10"' .15 `"0.15"' .20 `"0.20"' .25 `"0.25"' .30 `"0.30"' .35 `"0.35"' .4 `"0.40"' .45 `"0.45"' .5 `"0.50"', grid angle(horizontal) labsize(medsmall)) yscale(r(., .5)) plotopts(lwidth(thick) legend(col(1) ring(0) bplacement(1) region(style(none)) symxsize(*0.75) size(medsmall) label(1 "regular article") label(2 "comment"))) plot1opts(color(gs3%80) msymbol(O) msize(medium)) plot2opts(color(gs9%80) msymbol(S) msize(medium))
graph export "${output}/trend_difference_jama.eps", replace
graph export "${output}/trend_difference_jama.png", replace




//
// Nature

// call data
use "${data}/output/nature_data_gender.dta", clear
drop if year==2020
keep if comment | research_article

// bin 2-year intervals together for less noisy figure
generate aggyear = .
local i = 1
forvalues y=2004(2)2018 {
	replace aggyear = `i' if year>=`y' & year<=`y'+1
	local i = `i'+1
}

//variable labels for graph
label define pubtype 0 "regular article" 1 "comment"
label values comment pubtype

// analysis
regress `female' i.comment##i.aggyear if `known_gender'
margins aggyear#comment
marginsplot, plotregion(style(none)) scheme(s1color) title("") xtitle("Years") ytitle("Share of female authors") noci xlabel(1 `"04-05"' 2 `"06-07"' 3 `"08-09"' 4 `"10-11"' 5 `"12-13"' 6 `"14-15"' 7 `"16-17"' 8 `"18-19"' ,noticks labsize(medsmall)) ylabel(0 0.05 `"0.05"' .10 `"0.10"' .15 `"0.15"' .20 `"0.20"' .25 `"0.25"' .30 `"0.30"' .35 `"0.35"' .4 `"0.40"' .45 `"0.45"' .5 `"0.50"', grid angle(horizontal) labsize(medsmall)) yscale(r(., .5)) plotopts(lwidth(thick) legend(col(1) ring(0) bplacement(1) region(style(none)) symxsize(*0.75) size(medsmall) label(1 "regural article") label(2 "comment"))) plot1opts(color(gs3%80) msymbol(O) msize(medium)) plot2opts(color(gs9%80) msymbol(S) msize(medium))
graph export "${output}/trend_difference_nature.eps", replace
graph export "${output}/trend_difference_nature.png", replace



//
// PNAS

// call data
use "${data}/output/pnas_data_gender.dta", clear
drop if full_name=="II" | full_name=="III" | full_name=="IV" | full_name=="Jr" | full_name=="Jr."  // erroneously scraped as separate author-article observations
drop if year==2020 | year<2008  // PNAS started comments in 2008
keep if comment | research_article

// bin 2-year intervals together for less noisy figure
generate aggyear = .
local i = 1
forvalues y=2008(2)2018 {
	replace aggyear = `i' if year>=`y' & year<=`y'+1
	local i = `i'+1
}

//variable labels for graph
label define pubtype 0 "regular article" 1 "comment"
label values comment pubtype

// analysis
regress `female' i.comment##i.aggyear if `known_gender'
margins aggyear#comment
marginsplot, plotregion(style(none)) scheme(s1color) title("") xtitle("Years") ytitle("Share of female authors") noci xlabel(1 `"08-09"' 2 `"10-11"' 3 `"12-13"' 4 `"14-15"' 5 `"16-17"' 6 `"18-19"' ,noticks labsize(medsmall)) ylabel(0 0.05 `"0.05"' .10 `"0.10"' .15 `"0.15"' .20 `"0.20"' .25 `"0.25"' .30 `"0.30"' .35 `"0.35"' .4 `"0.40"' .45 `"0.45"' .5 `"0.50"', grid angle(horizontal) labsize(medsmall)) yscale(r(., .5)) plotopts(lwidth(thick) legend(col(1) ring(0) bplacement(1) region(style(none)) symxsize(*0.75) size(medsmall) label(1 "regural article") label(2 "comment"))) plot1opts(color(gs3%80) msymbol(O) msize(medium)) plot2opts(color(gs9%80) msymbol(S) msize(medium))
graph export "${output}/trend_difference_pnas.eps", replace
graph export "${output}/trend_difference_pnas.png", replace



//
// Science

// call data
use "${data}/output/science_data_gender.dta", clear
drop if year==2020
keep if comment | research_article

// bin 2-year intervals together for less noisy figure
generate aggyear = .
local i = 1
forvalues y=1998(2)2018 {
	replace aggyear = `i' if year>=`y' & year<=`y'+1
	local i = `i'+1
}

//variable labels for graph
label define pubtype 0 "regular article" 1 "comment"
label values comment pubtype

// analysis
regress `female' i.comment##i.aggyear if `known_gender'
margins aggyear#comment
marginsplot, plotregion(style(none)) scheme(s1color) title("") xtitle("Years") ytitle("Share of female authors") noci xlabel(1 `"98-99"' 2 `"00-01"' 3 `"02-03"' 4 `"04-05"' 5 `"06-07"' 6 `"08-09"' 7 `"10-11"' 8 `"12-13"' 9 `"14-15"' 10 `"16-17"' 11 `"18-19"', noticks labsize(medsmall)) ylabel(0 0.05 `"0.05"' .10 `"0.10"' .15 `"0.15"' .20 `"0.20"' .25 `"0.25"' .30 `"0.30"' .35 `"0.35"' .4 `"0.40"' .45 `"0.45"' .5 `"0.50"', grid angle(horizontal) labsize(medsmall)) yscale(r(., .5)) plotopts(lwidth(thick) legend(col(1) ring(0) bplacement(1) region(style(none)) symxsize(*0.75) size(medsmall) label(1 "regular article") label(2 "comment"))) plot1opts(color(gs3%80) msymbol(O) msize(medium)) plot2opts(color(gs9%80) msymbol(S) msize(medium))
graph export "${output}/trend_difference_science.eps", replace
graph export "${output}/trend_difference_science.png", replace

